home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 November: Tool Chest / Dev.CD Nov 00 TC Disk 1.toast / Sample Code / Networking / OTStreamLogViewer / IC Libraries / ICDialogs.h < prev    next >
Encoding:
Text File  |  2000-09-28  |  4.7 KB  |  111 lines  |  [TEXT/CWIE]

  1. /*    This file is part of the Internet Configuration system and is placed in the public domain for the benefit of all.
  2.  
  3.     This module implements many many tiny little routines that are of great assistance
  4.     to those who use the Dialog Manager as a user interface.  Most of these routines
  5.     are pretty obvious, so there's not a lot of comments in the interface section.
  6.     However there may be comments in the implementation section that you might
  7.     find interesting.
  8. */
  9.  
  10. #import <Dialogs.h>
  11.  
  12. #if ! GENERATINGCFM
  13.  
  14.     // Blargh!  Pascal 68K uses all upper case to make data
  15.     // exports case insensitive.  Pascal PPC exports data
  16.     // as case sensitive.  C is always case sensitive.
  17.     // So, if I declare the variables in lower case, Pascal
  18.     // 68K gets upset.  And if I declare the variables in
  19.     // upper case, Pascal PPC exports them in mixed case,
  20.     // so C PPC can't see them.  If I use $J+ on the Pascal
  21.     // side, they're exported in mixed case but Pascal 68K
  22.     // can't see them!
  23.     //
  24.     // Hence the yucky macros.
  25.     
  26.     #define gDefalutButtonUPP GDEFAULTBUTTONUPP
  27.     #define gOKModalFilterUPP GOKMODALFILTERUPP
  28.     #define gOKCancelModalFilter GOKCANCELMODALFILTER
  29.     #define gOKCancelDiscardModalFilter GOKCANCELDISCARDMODALFILTER
  30. #endif
  31.  
  32. enum {
  33.     ditOK = 1,
  34.     ditCancel =2,
  35.     ditDontSave = 3
  36. };
  37.         
  38. /* ***** Better Getters and Setters ***** */
  39.         
  40. extern pascal void GetDItemText(DialogPtr dlg, SInt16 item, Str255 text);
  41. extern pascal void SetDItemText(DialogPtr dlg, SInt16 item, ConstStr255Param text);
  42.  
  43. extern pascal void GetDItemKind(DialogPtr dlg, SInt16 item, SInt16 *kind);
  44. extern pascal void SetDItemKind(DialogPtr dlg, SInt16 item, SInt16 kind);
  45. extern pascal Handle GetDItemHandle(DialogPtr dlg, SInt16 item);
  46. extern pascal void SetDItemHandle(DialogPtr dlg, SInt16 item, Handle itemH);
  47. extern pascal void GetDItemRect(DialogPtr dlg, SInt16 item, Rect *itemRect);
  48. extern pascal void SetDItemRect(DialogPtr dlg, SInt16 item, const Rect *itemRect);
  49.  
  50.     /* ***** Dialog Control Getters and Setters ***** */
  51.  
  52. extern pascal ControlHandle GetDControlHandle(DialogPtr dlg, SInt16 item);
  53.     
  54. extern pascal Boolean GetDControlEnable(DialogPtr dlg, SInt16 item);
  55. extern pascal void SetDControlEnable(DialogPtr dlg, SInt16 item, Boolean enable);
  56. // extern pascal xxxx GetDControlTitle(DialogPtr dlg, SInt16 item);
  57. extern pascal void SetDControlTitle(DialogPtr dlg, SInt16 item, ConstStr255Param title);
  58. extern pascal SInt16 GetDControlValue(DialogPtr dlg, SInt16 item);
  59. extern pascal void SetDControlValue(DialogPtr dlg, SInt16 item, SInt16 value);
  60. extern pascal SInt16 GetDControlMaximum(DialogPtr dlg, SInt16 item);
  61. extern pascal void SetDControlMaximum(DialogPtr dlg, SInt16 item, SInt16 value);
  62. extern pascal Boolean GetDControlBoolean(DialogPtr dlg, SInt16 item);
  63. extern pascal void SetDControlBoolean(DialogPtr dlg, SInt16 item, Boolean value);
  64. extern pascal void ToggleDControlBoolean(DialogPtr dlg, SInt16 item);
  65.  
  66.     /* ***** Default Button Support ***** */
  67.  
  68. extern UserItemUPP gDefaultButtonUPP;
  69.         
  70. extern pascal void DefaultButtonUserItem(DialogPtr dlg, SInt16 item);
  71. extern pascal void SetupDefaultButtonUserItem(DialogPtr dlg, SInt16 defaultItem, SInt16 roundRectUserItem);
  72.     /* See comment in implementation part. */
  73.     
  74.     /* ***** Cool Filter Functions ***** */
  75.     
  76.     /* Some of this functionality is subsumed by System 7's standard
  77.         filter functions, but IC can't use them because it has to run
  78.         under System 6.
  79.         
  80.         These routines are exported as both UPP and routines because
  81.         some places in IC(such as filter functions that are layered
  82.         on top of these default filter functions) need to call them directly.
  83.     */
  84.  
  85. extern ModalFilterUPP gOKModalFilterUPP;
  86. extern ModalFilterUPP gOKCancelModalFilter;
  87. extern ModalFilterUPP gOKCancelDiscardModalFilter;
  88.  
  89. extern pascal Boolean OKModalFilter(DialogPtr dlg, EventRecord *event, SInt16 *item);
  90. extern pascal Boolean OKCancelModalFilter(DialogPtr dlg, EventRecord *event, SInt16 *item);
  91. extern pascal Boolean OKCancelDiscardModalFilter(DialogPtr dlg, EventRecord *event, SInt16 *item);
  92.  
  93.     /* ***** Stuff That Should Be In the Dialog Manager ***** */
  94.  
  95. extern pascal SInt16 CountDItems(DialogPtr dlg);
  96. extern pascal SInt16 GetSelectedDialogTextItem(DialogPtr dlg);
  97. extern pascal Boolean DialogItemHidden(DialogPtr dlg, SInt16 item);
  98. extern pascal MenuHandle GetDPopupMenuHandle(DialogPtr dlg, SInt16 item);
  99. extern pascal void InvalDItem(DialogPtr dlg, SInt16 item);
  100.  
  101.     /* ***** Miscellaneous Stuff ***** */
  102.     
  103. extern pascal void DrawStyledString(DialogPtr dlg, SInt16 item, ConstStr255Param styledString);
  104. extern pascal void ShiftTab(DialogPtr dlg);
  105. extern pascal void FlashDItem(DialogPtr dlg, SInt16 item);
  106. extern pascal Boolean TrackDItem(WindowPtr window, SInt16 item);
  107.  
  108.     /* ***** Initialisation ***** */
  109.     
  110. extern pascal void InitICDialogs(void);
  111.